Skip to content

Fix #21030#21049

Open
pranavmanglik wants to merge 2 commits intopython:masterfrom
pranavmanglik:master
Open

Fix #21030#21049
pranavmanglik wants to merge 2 commits intopython:masterfrom
pranavmanglik:master

Conversation

@pranavmanglik
Copy link
Copy Markdown

@pranavmanglik pranavmanglik commented Mar 19, 2026

This PR ensures that decorators applied to a TypedDict class definition are correctly analyzed for undefined names.

Previously, the semantic analyzer's special-case handling for TypedDict (analyze_typeddict_classdef) was returning early without visiting the decorators list in the ClassDef. This caused mypy to silently ignore invalid names, attributes, or subscripted expressions used as decorators on these classes.

Fixes #21030

@github-actions

This comment has been minimized.

@pranavmanglik pranavmanglik changed the title Fixes #21030: Undefined names used as decorators on top of TypedDict are not reported #21030: Fix Undefined names used as decorators on top of TypedDict are not reported Apr 5, 2026
@pranavmanglik pranavmanglik changed the title #21030: Fix Undefined names used as decorators on top of TypedDict are not reported Fix #21030 Apr 5, 2026
@bzoracler
Copy link
Copy Markdown
Contributor

bzoracler commented Apr 5, 2026

You added a new test case in the middle of an existing test case. Please fix that and make CI pass, and a repository owner/collaborator might take a look.

Also, edit your initial post to say "# Fixes 21030" without quotes in the post body (not the title).

@pranavmanglik pranavmanglik changed the title Fix #21030 # Fixes 21030 Apr 6, 2026
@pranavmanglik pranavmanglik changed the title # Fixes 21030 Fix #21030 Apr 6, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 6, 2026

According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Undefined names used as decorators on top of TypedDict are not reported

2 participants